<template>
    <div>
         <h2 align="center">注册页面</h2>
        <table class="table table-bordered">
            <tbody>
                <tr>
                <td align="right">账号</td>
                <td><input type="text" v-model="adduser.userName"/></td>
            </tr>
            <tr>
                <td align="right">密码</td>
                <td><input type="password"  v-model="adduser.userPwd"></td>
            </tr>
            <!-- <tr>
                <td align="right">性别</td>
                <td>
                    <input type="radio" name="gender" v-bind:value="1" v-model="adduser.sex">男
                    <input type="radio" name="gender" v-bind:value="0" v-model="adduser.sex">女
                </td>
            </tr>
            <tr>
                <td align="right">爱好</td>
                <td>
                    <input type="checkbox" name="likes" v-model="adduser.likes" value="唱">唱
                    <input type="checkbox" name="likes" v-model="adduser.likes" value="跳">跳
                    <input type="checkbox" name="likes" v-model="adduser.likes" value="rap">rap
                    <input type="checkbox" name="likes" v-model="adduser.likes" value="打篮球">打篮球
                </td>
            </tr>
            <tr>
                <td align="right">出生日期</td>
                <td>
                    <input type="date"  v-model="adduser.bir">
                    
                </td>
            </tr>
            <tr>
                <td align="right">籍贯</td>
                <td>
                    <select  v-model="adduser.nation">
                        <option value="">请选择</option>
                        <option :value="1">河北</option>
                        <option :value="2">湖北</option>
                        <option :value="3">湖南</option>
                        <option :value="4">北京</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td align="right">年龄</td>
                <td>
                   <input type="number"  v-model="adduser.age">
                </td>
            </tr>
            <tr>
                <td align="right">个人简介</td>
                <td>
                    <textarea  v-model="adduser.into">

                    </textarea>
                    
                </td>
            </tr> -->
            <tr>
                <td></td>
                <td><input type="button" class="btn btn-info" value="注册" @click="info"></td>
            </tr>
            </tbody>
            
        </table>
        <p>{{ adduser }}</p>
    </div>
</template>

<script setup lang="ts">
import axios from "axios";
import { ref,reactive } from "vue"; 
    let adduser=ref({
        userName:'',
        userPwd:'',
    });
    const info=()=>{
        axios({
            url:"/api/Admin/AddAmin",
            method:"post",
            data:adduser.value,
        })
        .then((res)=>{
            console.log(res);
            if(res.data==-1)
            {
                alert("名称已存在");
                return;
            }
             if(res.data>0)
            {
                alert("注册成功");
                return;
            }
        })
        .catch((err)=>{
            console.log(err);
        })
    }
    
</script>

<style scoped>

</style>